package com.qf.smartdevice.controller;

import com.qf.smartdevice.dto.R;
import com.qf.smartdevice.pojo.Menus;
import com.qf.smartdevice.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menus")
public class MenuController {
    @Autowired
    private IMenuService menuService;

    @GetMapping("/menus")
    public R getMenus() {
        System.out.println("哈哈哈");

        //通过service 调用mapper 最后返回所有的菜单
        List<Menus> menusList = menuService.findAllMenus();
        return R.setOk(menusList);

    }

}
